#include <stm8s_flash.h>

#if defined (_SDCC_)    
extern  uint32_t    asm_addr;      // 16b/24b address
extern  uint8_t     asm_val;       // 1B data for r/w data

void write_byte_address(uint16_t Address, uint8_t Data)
{
  /* store address & data globally for assember */
  asm_addr = Address;
  asm_val  = Data;

  /* use inline assembler to write to 16b/24b address */
  __asm
  ld	a,_asm_val
  ldf	[_asm_addr+1].e,a
__endasm;
}


#endif // _SDCC_
/**
  * @brief  Reads any byte from flash memory
  * @note   is required for SDCC, which doesn't yet support far pointers.
  *         For simplicity 16- and 24-bit pointers are treated identically.
  * @param  Address : Address to read
  * @retval Value of the byte
  */
